package cn.yanhu.kuwanapp.welfare.ad

import android.content.Context
import android.view.View
import android.view.ViewGroup

/**
 *广告流程
 *@author woochen
 *@time 2019-12-15 18:04
 */
interface IAdProcess {
    var mAdLoadLifecycle: AdLoadLifecycle?

    /**
     *
     * @param context Context
     * @param slotType 广告类型
     * @see com.app.miaoaiwan.common.ad.AdSlotType
     * @param codeId String 用于请求广告的平台广告id
     * @param isPortation 是不是竖屏 true是
     * @param innerCodeId 广告记录id
     * @param containerView ViewGroup
     * @param adTimeOut Int
     */
    fun loadAd(context: Context, slotType: Int, codeId: String,isPortation :Boolean = true,innerCodeId:String,containerView:ViewGroup? = null,adTimeOut:Int = 0)//加载广告

    fun showAd(context: Context, slotType: Int)//显示广告

    interface AdLoadLifecycle{
        fun adPlayStart(innerCodeId: String)//广告开始播放

        fun adShowed(innerCodeId: String)//广告显示(非激励视频即广告播放完成)

        fun adClicked(innerCodeId: String)//广告被点击

        fun adReward(innerCodeId: String)//有效播放

        fun aDExpose(innerCodeId: String)//曝光成功

        fun adDismissed(innerCodeId: String)//广告关闭

        fun adPlayComplete(innerCodeId: String)//广告播放完成

        fun adLoadFail(innerCodeId: String,msgError:String="")//广告加载失败

        fun adLoadComplete(innerCodeId: String,view :View?=null,length :Long?=0)//广告加载完成准备渲染

        fun adLoadStart(innerCodeId: String)//广告开始加载

        fun adSkiped(innerCodeId: String)//广告被跳过

        fun onInstalled(innerCodeId: String)//apk安装

        fun onDownloading(innerCodeId: String)//apk下载中

        fun onDownloaded(innerCodeId: String)//apk下载完成
    }


    fun release()

}